package LCR;

public class Direct_selection_sort {
    public static void main(String[] args) {
//        int[] ret = new int[]{5, 7, 9, 1, 3, 2, 8};
        int[] ret = new int[]{3, 2};
        select_sort(ret);
        for (int x :
                ret) {
            System.out.print(x + " ");
        }
    }

    static void select_sort(int[] a) {//升序
        int n = a.length;

        for (int i = 0; i < n - 1; i++) {
            int min = i;
            for (int j = i + 1; j < n ; j++) {
                if (a[j] < a[min]) {
                    min = j;
                }
            }
            int tem = a[min];
            a[min] = a[i];
            a[i] = tem;
        }
    }
}
